<?php  
namespace Admin\Model;
use Think\Model\RelationModel;
class GoodsModel extends RelationModel{
	public $_link = array(
		'comment'=>self::HAS_MANY,
		);
	//自动过滤
	// public $insertFields="goods_name,goods_sn";
	// 自动验证
	protected $_validate = array(
//array(验证字段1,验证规则,错误提示,[验证条件,附加规则,验证时间]),
		array("goods_name","require","商品名称不能为空!","1","","3"),
		array("goods_sn","require","商品货号不能为空!","1","","3"),
		array("goods_sn","","商品货号已经存在!","1","unique","3"),
		//callback验证调用函数是否为true和false
		array("shop_price","pr","shop_price错了!","1","callback","3"),
		);
	 protected $_auto = array (
     // array(完成字段1,完成规则,[完成条件,附加规则]),
	 	array("add_time","time",3,"function"),
	 	);
	public function gettree()
	{
     return	$this->select();
	}
	public function pr()
	{
     return true;
	}

}